package com.tubi.TreeSet;

import java.util.Iterator;
import java.util.TreeSet;

public class TreeSeti {
    public static void main(String[] args) {
        TreeSet<Student> ts = new TreeSet<>();

        Student s1 = new Student("dahei",80,80,80);
        Student s2 = new Student("dahe2i",90,90,80);
        Student s3 = new Student("dahe21i",100,80,80);
        ts.add(s1);
        ts.add(s2);
        ts.add(s3);

        for (Student t : ts) {
            System.out.println(t);
        }
        //迭代器
        Iterator<Student> iterator = ts.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }

    }
}
